package com.itheima.controller;

import com.itheima.domain.KS;
import com.itheima.service.KSService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
@RequestMapping("/ks")
public class KSController {
    @Autowired
    private KSService ksService;
   /* @RequestMapping("/findAllKS")
    public ModelAndView findAllKS(ModelAndView modelAndView){
        List<KS> aLlKS = ksService.findALlKS ();
        modelAndView.addObject ( "aLlKS",aLlKS );
        modelAndView.setViewName ( "subscribe-form" );
        return modelAndView;
    }*/
   @RequestMapping("/findAllKS")
   @ResponseBody
   public List<KS> findAllKS(){
       List<KS> aLlKS = ksService.findALlKS ();
       return aLlKS;
   }
}
